package mergeSortArry

func Merge(A []int, m int, B []int, n int) {
	aPtr := m - 1
	bPtr := n - 1
	for i := m + n - 1; aPtr >= 0 && bPtr >= 0; i-- {
		if A[aPtr] > B[bPtr] {
			A[i] = A[aPtr]
			aPtr--
		} else {
			A[i] = B[bPtr]
			bPtr--
		}
	}
	for bPtr >= 0 {
		A[bPtr] = B[bPtr]
		bPtr--
	}
}
